<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<title>修改器材信息</title>
</head>
<body>
<s:form action="equipment_edit" method="post" onsubmit="return check()" name="f1">
		<table>
			<s:iterator value="equipment" var="var">
				<tr>
					<td width="150">名称：
<input type="text" name="name" id="name" value='<s:property value="#var.name" />'>
<input type="hidden" value='<s:property value="#var.id" />'name="equipmentId" id="equipmentId"></td>
				</tr>
				<tr>
					<td width="150">购买时间：
<input type="date" name="buyTime" id="buyTime" value='<s:property value="#var.buyTime" />'>
					</td>
				</tr>
				<tr>
					<td width="150">价格： 
<input type="text" name="price" id="price" value='<s:property value="#var.price" />'>
					</td>
				</tr>
				<tr>
					<td width="150">其他信息：：
<input type="text" name="detail" id="detail" value='<s:property value="#var.detail" />'>
					</td>
				</tr>
				<tr>
				<tr>
					<td><input type="submit" value="保存" class="btn btn-info">
					</td>
				</tr>
			</s:iterator>
		</table>
	</s:form>
	<script type="text/javascript">
   function check(){
		var name = document.f1.name;
		var buyTime = document.f1.buyTime;
		var detail = document.f1.detail;
		var price = document.f1.price;
		var reNum =/^[0-9]+$/;
		if(name.value==""||buyTime.value==""||detail.value==""||price.value==""){
			alert("必填项不能为空！");
			return false;
		}
		if(!reNum.test(price.value)){
			alert("“价格必须为数字！");
			return false;
		}
		
		else{
			return true;
		}
	}
    </script>
</body>
</html>